<?php
namespace Devcopilot\Controllers;

use Zyucv7\Core\Web\Response\JsonResponse;
use Zyucv7\Core\View\View;

class Front
{
    private $view;

    public function __construct()
    {
        $this->view = new View(DC_PATH . '/View');
    }

    protected function assign($name, $value)
    {
        $this->view->with($name, $value);
    }

    public function display($path)
    {
        $html = $this->view->render($path);
        echo $html;
        exit;
    }

    public function ok($data = null)
    {
        JsonResponse::success($data);
    }

    public function error($data = null)
    {
        JsonResponse::error($data);
    }
}